package com.hyz.controller.assetManager;

import com.hyz.pojo.ResponseResult;
import com.hyz.pojo.assetManager.GetAssetImportByIdResponse;
import com.hyz.service.assetManager.AssetManagerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pojo.asset.asset.Asset;
import pojo.permission.assetManager.AssetImportRequest;

import java.util.List;

/**
 * @author HGD
 * @date 2022/10/2 16:46
 */
@RestController
@RequestMapping("/assetManager")
@Api("资产管理员控制类")
public class AssetManagerController {
    @Autowired
    private AssetManagerService service;

    @ApiOperation("资产管理员获取未分库资产")
    @ApiResponse(code = 200, message = "返回未分库资产", response = Asset.class)
    @PostMapping("/getUnassignedAsset")
    public ResponseResult<List<Asset>> getUnassignedAsset() {
        return service.getUnassignedAsset();
    }

    @ApiOperation("资产管理员对批量资产入库")
    @ApiResponse(code = 200, message = "创建入库申请，正在审核", response = String.class)
    @PostMapping("/createAssetImport")
    public ResponseResult<String> createAssetImport(@ApiParam("资产入库请求") @RequestBody AssetImportRequest request) {
        System.out.println(request);
        return service.createAssetImport(request);
    }

    @ApiOperation("资产管理员搜索资产入库结果")
    @ApiResponse(code = 200, message = "返回资产结果", response = Asset.class)
    @PostMapping("/getAssetImportByUserId")
    public ResponseResult<List<GetAssetImportByIdResponse>> getAssetImportByUserId() {
        return null;
    }
}
